
function processApplication(language) {
    var txt = "<person>\n" +
        "  <submitter.firstname>" + getValueFromElement("submitter.firstname") + "</submitter.firstname>\n" +
        "  <email>" + getValueFromElement("email") + "</email>\n" +
        "  <fullname>" + getValueFromElement("fullname") + "</fullname>\n" +
        "  <fullname_ru>" + getValueFromElement("fullname_ru") + "</fullname_ru>\n" +
        "  <birthday>" + getValueFromElement("birthday") + "</birthday>\n" +
        "  <birthmonth>" + getValueFromElement("birthmonth") + "</birthmonth>\n" +
        "  <birthyear>" + getValueFromElement("birthyear") + "</birthyear>\n" +
        "  <birthplace>" + getValueFromElement("birthplace") + "</birthplace>\n" +
        "  <birthplace_ru>" + getValueFromElement("birthplace_ru") + "</birthplace_ru>\n" +
        "  <deathday>" + getValueFromElement("deathday") + "</deathday>\n" +
        "  <deathmonth>" + getValueFromElement("deathmonth") + "</deathmonth>\n" +
        "  <deathyear>" + getValueFromElement("deathyear") + "</deathyear>\n" +
        "  <deathplace>" + getValueFromElement("deathplace") + "</deathplace>\n" +
        "  <deathplace_ru>" + getValueFromElement("deathplace_ru") + "</deathplace_ru>\n" +
        "  <diagnosis>" + getValueFromElement("diagnosis") + "</diagnosis>\n" +
        "  <diagnosis_ru>" + getValueFromElement("diagnosis_ru") + "</diagnosis_ru>\n" +
        "  <relative-agrees-to-publish>" + document.getElementById("relative-agrees-to-publish").checked + "</relative-agrees-to-publish>\n" +
        "  <about>" + getValueFromElement("about") + "</about>\n" +
        "  <about_ru>" + getValueFromElement("about_ru") + "</about_ru>\n" +
        "  <about-signature>" + getValueFromElement("about-signature") + "</about-signature>\n" +
        "  <about-signature_ru>" + getValueFromElement("about-signature_ru") + "</about-signature_ru>\n" +
//        "  <>" + getValueFromElement("") + "</>\n" +
        "</person>";
    
    document.getElementById("message-xml").value=txt;

    var email = "fight-cancer@frenkel.ca";

    var subject;
    if (language == "ru") {
        subject = "Добавить человека";
    } else {
        subject = "Submit person";
    }

    var mailto_link = 'mailto:'+email+'?subject='+subject+'&body='+txt;

    win = window.open(mailto_link,'emailWindow');
}

function getValueFromElement(elementId) {
    var element = document.getElementById(elementId);
    if (element == null) {
        return "";
    } else {
        return element.value;
    }
}